# Makefile core
ROOTDIR = ..
include $(ROOTDIR)/Rules.make

CFLAGS := -Wall -O2 -g -D_XOPEN_SOURCE=500 -I $(ROOTDIR)/include $(INC_PATH)

APP_SRCS    :=  core.c
APP_OBJS    :=  core.o

PACK_APP_SRCS    :=  pack.c
PACK_APP_OBJS    :=  pack.o

OTHER	:=  $(wildcard *~)
OBJS := $(APP_OBJS) $(PACK_APP_OBJS)

APP := app
PACK_APP := pack_app

all: $(APP) $(PACK_APP) $(UNPACK_APP)
TARGET := $(APP) $(PACK_APP)

#$(OBJS)
#$(TARGET):
	#cp -f $(TARGET) $(ROOTDIR)/bin/

$(APP):
	$(CC) $(CFLAGS) -lpthread -lm  -o $(APP) $(APP_SRCS) $(LIBS) $(ROOTDIR)/lib/libmegaEyes.a $(ROOTDIR)/lib/libiconv.a $(ROOTDIR)/lib/libmxml.a   
	cp -f $(APP) $(ROOTDIR)/bin/
	
$(PACK_APP):
	$(CC) $(CFLAGS) -lpthread -lm -o $(PACK_APP) $(PACK_APP_SRCS) $(LIBS)	$(ROOTDIR)/lib/libmegaEyes.a
	cp -f $(PACK_APP) $(ROOTDIR)/bin/

clean:
	@rm -f $(TARGET)
	@rm -f $(OBJS)
	@rm -f $(OTHER)

